<?php
/*
 * @FileForDetails: 课程验证器
 * @Date: 2022-11-29 15:48:07
 */
namespace app\crm\validate\product;

use think\Validate;

class Course extends Validate
{
    /**
     * @Descripttion: 验证规则
     * @Date: 2022-11-29 15:59:24
     */
    protected $rule = [
        'name'        => "require|max:100",
        'price'       => 'require|float',
        'unit'        => 'require',
        'minute_hour' => 'require|number',
        'campus_id'   => 'require',
        'major_id'    => 'require',
    ];

    /**
     * @Descripttion: 提示消息
     * @Date: 2022-11-29 15:59:38
     */
    protected $message = [
    ];

    /**
     * @Descripttion: 验证场景
     * @Date: 2022-11-29 16:00:01
     */
    protected $scene = [
        'add' => [],
        'edit' => ['name'],
    ];

    public function __construct(array $rules = array(), $message = array(), $field = array())
    {
        $this->field = [
            'name'        => '课程名称',
            'price'       => '价格',
            'unit'        => '单位',
            'minute_hour' => '课时/分钟',
            'campus_id'   => '校区',
            'major_id'    => '专业',
        ];

        parent::__construct($rules, $message, $field);
    }
}
